;;;Creates a duplicate polyline/lwpolyline of specified width on new layer with color 250.
;;;Draworder command is exectued putting new polyline "Under" original polyline.
;;;Color 250 is intended to plot as true white leaving a blank space where the new polyline is.
;;;The net effect is a blank area of the specified width along the original polyline.
;;;Expects CAD Layer Guidelines (CLG) layers which it will match except for color.
;;;If CLG layer is not found it creates a new CLG layer "G-DETLUHIDE" by default.
;;;
;;;	Author:	Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;		http://paracadd.com
;;;		All rights reserved.
;;;
;;;		COPYRIGHT: 7-29-08
;;;		   EDITED: 7-29-08
;;;
(DEFUN C:HIDEPOLY ( / new_plent_lst plss plss_len plcnt athis_plent hide_layer)
  (IF ureal NIL (LOAD "ureal" "\nFile UREAL.LSP not loaded! "))
  (IF clnmstd NIL (LOAD "mklayr" "\nFile MKLAYR.LSP not loaded! "))
  (SETQ hide_width (ureal 1 "" "Hiding polyline width" hide_width))
  (SETQ plss (SSGET '((-4 . "<OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(-4 . "OR>"))))
  (SETQ plss_len (SSLENGTH plss))
  (SETQ plcnt 0)
  (WHILE (< plcnt plss_len)
    (SETQ this_plent (ENTGET (SSNAME plss plcnt)))
    (SETQ new_plent_lst (LIST (APPEND (LIST (CADR this_plent))(CDDDDR this_plent))))
    (SETQ clayr (CDR (ASSOC 8 this_plent)))
    (IF (clnmstd)
      (SETQ hide_layer (STRCAT (SUBSTR (CDR (ASSOC 8 this_plent)) 1 6) "U" (SUBSTR (CDR (ASSOC 8 this_plent)) 8)))
      (SETQ hide_layer "G-DETLUHIDE")
    )
    (layentmake hide_layer "250" "continuous")
    (IF (EQ (CDR (ASSOC 0 this_plent)) "POLYLINE")
      (PROGN
	(SETQ new_plent_lst (SUBST (SUBST (CONS 40 hide_width) (ASSOC 40 (CAR new_plent_lst))(CAR new_plent_lst))(CAR new_plent_lst) new_plent_lst))
	(SETQ new_plent_lst (SUBST (SUBST (CONS 41 hide_width) (ASSOC 41 (CAR new_plent_lst))(CAR new_plent_lst))(CAR new_plent_lst) new_plent_lst))
	(SETQ new_plent_lst (SUBST (SUBST (CONS 8 hide_layer) (ASSOC 8 (CAR new_plent_lst))(CAR new_plent_lst))(CAR new_plent_lst) new_plent_lst))
        (WHILE (NOT (EQ (CDR (ASSOC 0 (SETQ this_plent (ENTGET (ENTNEXT (CDR (ASSOC -1 this_plent))))))) "SEQEND"))
          (SETQ this_plent (SUBST (CONS 40 hide_width) (ASSOC 40 this_plent)this_plent))
          (SETQ this_plent (SUBST (CONS 41 hide_width) (ASSOC 41 this_plent)this_plent))
          (SETQ this_plent (SUBST (CONS 8 hide_layer) (ASSOC 8 this_plent)this_plent))
	  (SETQ new_plent_lst (APPEND new_plent_lst (LIST (APPEND (LIST (CADR this_plent))(CDDDDR this_plent)))))
        )
	(FOREACH n new_plent_lst
	  (ENTMAKE n)
	)
	(ENTMAKE (LIST (CONS 0 "SEQEND")))
      )
      (PROGN
	(WHILE (MEMBER (CONS 40 0.0) this_plent)
	  (SETQ this_plent (SUBST (CONS 40 hide_width)(CONS 40 0.0) this_plent))
	)
	(WHILE (MEMBER (CONS 41 0.0) this_plent)
	  (SETQ this_plent (SUBST (CONS 41 hide_width)(CONS 41 0.0) this_plent))
	)
        (SETQ this_plent (SUBST (CONS 43 hide_width) (ASSOC 43 this_plent)this_plent))
        (SETQ this_plent (SUBST (CONS 8 hide_layer) (ASSOC 8 this_plent)this_plent))
	(SETQ this_plent (APPEND (LIST (CADR this_plent))(CDDDDR this_plent)))
	(ENTMAKE this_plent)
      )
    )
    (COMMAND ".draworder" (entlast) "" "Under" (ssname plss plcnt))
    (SETQ plcnt (1+ plcnt))
  )
  (PRINC)
)